import { Injectable } from '@nestjs/common';
import { Transporter, createTransport } from 'nodemailer'


@Injectable()
export class EmailService {
    transporter: Transporter

    constructor() {
        this.transporter = createTransport({
            host: "smtp.qq.com",
            port: 587,
            secure: false,
            auth: {
                user: '2993819866@qq.com',
                pass: 'hkcckdjcdxkgdfhe'
            },
        })


    }
    async sendMail({ to, subject, html }) {
        await this.transporter.sendMail({
            from: {
                name: '秃秃会客室',
                address: '2993819866@qq.com'
            },
            to,
            subject,
            html,
        });
        
    }
}
